\tikzset{
%Define standard arrow tip
>=stealth',
%Define style for different line styles
help lines/.style={dashed, thick},
axis/.style={very thick, <->},
important line/.style={thick},
connection/.style={thick, dotted},
}

\newcommand{\graficoUno}{%
  \begin{tikzpicture}[
  xscale=0.7,
  yscale=0.6,
  mrsp/.style={ fill=black!30},
  pfp/.style={ fill=black!80}
  ]
    % Axis
    \coordinate (y) at (0,10);
    \coordinate (x) at (14,0);
    \draw[axis] (y) node[above=-2cm, rotate=90, font=\small] {\# Deadline miss} -- (0,0) --  (x) node[right, font=\small] {Utilization};

\draw[pfp]  (3, 8) rectangle +(1, 0.5);
\path(3.5, 8.5)node[above] {{\small P-FP}};
\draw[mrsp]  (6, 8) rectangle +(1, 0.5);
\path(6.5, 8.5)node[above] {{\small P-FP + MrsP}};

\path(2,0)node[below]{\small 50\%};
\path(4,0)node[below]{\small 60\%};
\path(6,0)node[below]{\small 70\%};
\path(8,0)node[below]{\small 75\%};
\path(10,0)node[below]{\small 80\%};
\path(12,0)node[below]{\small 85\%};

\path(2.4,.8)node[below]{\small 0};
\path(4.4,.8)node[below]{\small 0};
\path(6.4,.8)node[below]{\small 0};
\path(8.4,.8)node[below]{\small 0};

\path(1.6,.8)node[below]{\small 0};
\path(3.6,.8)node[below]{\small 0};
\path(5.6,.8)node[below]{\small 0};
\path(7.6,.8)node[below]{\small 0};

\draw[pfp]  (1.3, 0) rectangle +(0.6, 0.05);
\draw[mrsp]  (2.1, 0) rectangle +(0.6, 0.05);

\draw[pfp]  (3.3, 0) rectangle +(0.6, 0.05);
\draw[mrsp]  (4.1, 0) rectangle +(0.6, 0.05);

\draw[pfp]  (5.3, 0) rectangle +(0.6, 0.05);
\draw[mrsp]  (6.1, 0) rectangle +(0.6, 0.05);

\draw[pfp]  (7.3, 0) rectangle +(0.6, 0.05);
\draw[mrsp]  (8.1, 0) rectangle +(0.6, 0.05);

%PFP 80%
\path(9.6,1.5)node[below]{\small 102};
\draw[pfp]  (9.3, 0) rectangle +(0.6, 0.5);

% MRSP 80%
\path(10.4,1.5)node[below]{\small 102};
\draw[mrsp]  (10.1, 0) rectangle +(0.6, 0.5);

%PFP 85%
\path(11.5,9)node[below]{\small 1672};
\draw[pfp]  (11.3, 0) rectangle +(0.6, 8);

% MRSP 85%
\path(12.5,9)node[below]{\small 1672};
\draw[mrsp]  (12.1, 0) rectangle +(0.6, 8);

%50  60  70  75  80  85
%0 0 0 0 102 1672

\end{tikzpicture}}

\newcommand{\confrontoProtocolliLUno}{%
  \begin{tikzpicture}[
  xscale=0.8,
  yscale=0.6,
  mrsp/.style={fill=black!30},
  ceiling/.style={ fill=black!50},
  nopreempt/.style={fill=black!80},
  assi/.style={very thick, <-}
  ]
    % Axis
    \coordinate (y) at (0,8);
    \coordinate (x) at (12,0);
    \draw[assi] (y) node[above=-3cm, right=-0.9cm, rotate=90, font=\tiny] {Response time} -- (0,0) -- (x);

    \coordinate (one) at (1.5,-0.5);
    \coordinate (two) at (4.5,-0.5);
    \coordinate (three) at (7.5,-0.5);
    \coordinate (four) at (10.5,-0.5);
%4 gruppi
%3 barre ognuno

\draw[line width=0.1mm, gray, dashed] (-0.7,1)node[black, above=0.2cm, right=-0.2cm] {\tiny 1 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,2)node[black, above=0.2cm, right=-0.2cm] {\tiny 2 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,3)node[black, above=0.2cm, right=-0.2cm] {\tiny 3 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,4)node[black, above=0.2cm, right=-0.2cm] {\tiny 4 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,5)node[black, above=0.2cm, right=-0.2cm] {\tiny 5 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,6)node[black, above=0.2cm, right=-0.2cm] {\tiny 6 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,7)node[black, above=0.2cm, right=-0.2cm] {\tiny 7 $ ms$} -- +(12.5, 0);

\path(one)node[below=+0.1cm]{\tiny CS = 1ms};
\path(one)node[below=-0.2cm]{\tiny WCET = 1ms};

\path(two)node[below=+0.1cm]{\tiny CS = 3ms};
\path(two)node[below=-0.2cm]{\tiny WCET = 1ms};

\path(three)node[below=+0.1cm]{\tiny CS = 1ms};
\path(three)node[below=-0.2cm]{\tiny WCET = 3ms};

\path(four)node[below=+0.1cm]{\tiny CS = 1ms};
\path(four)node[below=-0.2cm]{\tiny WCET = 3ms};
\path(four)node[below=+0.4cm]{\tiny 2 migrations};

%%%%%%%%%%  L1
%  MRSP - CEILING - NP

% PRIMO (1 - 1)
% $L_1$ & \underline{1.206.362} & 2.194.042 & \underline{1.111.517}

% gruppo uno - coord 0 -- 3
\draw[mrsp]  (0.4, 0) rectangle +(0.6, 1.2);
\draw[ceiling]  (1.2, 0) rectangle +(0.6, 2.1);
\draw[nopreempt]  (2, 0) rectangle +(0.6, 1.1);

% SECONDO (SC3 - h1)
%$L_1$ & \underline{3.066.828} & 4.242.092 & \underline{3.177.307}

% gruppo uno - coord 3 -- 6
\draw[mrsp]  (3.4, 0) rectangle +(0.6, 3.17);
\draw[ceiling]  (4.2, 0) rectangle +(0.6, 4.2);
\draw[nopreempt]  (5, 0) rectangle +(0.6, 3.05);

%TERZO (SC1 - H3)
%$L_1$ & \underline{1.053.232} & 4.215.599 & \underline{1.113.397}

% gruppo uno - coord 6 -- 9
\draw[mrsp]  (6.4, 0) rectangle +(0.6, 1.05);
\draw[ceiling]  (7.2, 0) rectangle +(0.6, 4.2);
\draw[nopreempt]  (8, 0) rectangle +(0.6, 1.1);

%QUARTO (SC1 - H3)^2
%$L_1$ & \underline{1.111.410} & 4.312.490 & \underline{1.173.600}

% gruppo uno - coord 9 -- 12
\draw[mrsp]  (9.4, 0) rectangle +(0.6, 1.1);
\draw[ceiling]  (10.2, 0) rectangle +(0.6, 4.3);
\draw[nopreempt]  (11, 0) rectangle +(0.6, 1.1);

%legend
\begin{scope}[shift={(2,8.5)}] 
\draw[mrsp] (0,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\scriptsize MrsP};
\draw[ceiling] (3,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\tiny Simple Ceiling};
\draw[nopreempt] (6,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\tiny Non preemption};
\end{scope}

\end{tikzpicture}}

\newcommand{\confrontoProtocolliHDue}{%
  \begin{tikzpicture}[
  xscale=0.8,
  yscale=0.6,
  mrsp/.style={fill=black!30},
  ceiling/.style={ fill=black!50},
  nopreempt/.style={fill=black!80},
  assi/.style={very thick, <-}
  ]
    % Axis
    \coordinate (y) at (0,8);
    \coordinate (x) at (12,0);
    \draw[assi] (y) node[above=-3cm, right=-0.9cm, rotate=90, font=\tiny] {Response time} -- (0,0) -- (x);

    \coordinate (one) at (1.5,-0.5);
    \coordinate (two) at (4.5,-0.5);
    \coordinate (three) at (7.5,-0.5);
    \coordinate (four) at (10.5,-0.5);
%4 gruppi
%3 barre ognuno

\draw[line width=0.1mm, gray, dashed] (-0.7,1)node[black, above=0.2cm, right=-0.2cm] {\tiny 1 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,2)node[black, above=0.2cm, right=-0.2cm] {\tiny 2 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,3)node[black, above=0.2cm, right=-0.2cm] {\tiny 3 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,4)node[black, above=0.2cm, right=-0.2cm] {\tiny 4 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,5)node[black, above=0.2cm, right=-0.2cm] {\tiny 5 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,6)node[black, above=0.2cm, right=-0.2cm] {\tiny 6 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,7)node[black, above=0.2cm, right=-0.2cm] {\tiny 7 $ ms$} -- +(12.5, 0);

\path(one)node[below=+0.1cm]{\tiny CS = 1ms};
\path(one)node[below=-0.2cm]{\tiny WCET = 1ms};

\path(two)node[below=+0.1cm]{\tiny CS = 3ms};
\path(two)node[below=-0.2cm]{\tiny WCET = 1ms};

\path(three)node[below=+0.1cm]{\tiny CS = 1ms};
\path(three)node[below=-0.2cm]{\tiny WCET = 3ms};

\path(four)node[below=+0.1cm]{\tiny CS = 1ms};
\path(four)node[below=-0.2cm]{\tiny WCET = 3ms};
\path(four)node[below=+0.4cm]{\tiny 2 migrations};

%%%%%%%%%%  H2
%  MRSP - CEILING - NP

% PRIMO (1 - 1)
% $H_2$ & 1.098.587 & 1.068.602 & 1.977.039 \\

% gruppo uno - coord 0 -- 3
\draw[mrsp]  (0.4, 0) rectangle +(0.6, 1.005);
\draw[ceiling]  (1.2, 0) rectangle +(0.6, 1.008);
\draw[nopreempt]  (2, 0) rectangle +(0.6, 1.9);

% SECONDO (SC3 - h1)
%$H_2$ & 1.035.721 & 1.141.324 & 3.956.506 \\

% gruppo uno - coord 3 -- 6
\draw[mrsp]  (3.4, 0) rectangle +(0.6, 1.035);
\draw[ceiling]  (4.2, 0) rectangle +(0.6, 1.09);
\draw[nopreempt]  (5, 0) rectangle +(0.6, 3.9);

%TERZO (SC1 - H3)
%$H_2$ & 3.018.344 & 3.071.190 & 4.006.309 \\

% gruppo uno - coord 6 -- 9
\draw[mrsp]  (6.4, 0) rectangle +(0.6, 3.01);
\draw[ceiling]  (7.2, 0) rectangle +(0.6, 3.05);
\draw[nopreempt]  (8, 0) rectangle +(0.6, 4.005);

%QUARTO (SC1 - H3)^2
% $H_2$ & 3.029.214 & 3.131.630 & 4.205.578 \\

% gruppo uno - coord 9 -- 12
\draw[mrsp]  (9.4, 0) rectangle +(0.6, 3.02);
\draw[ceiling]  (10.2, 0) rectangle +(0.6, 3.05);
\draw[nopreempt]  (11, 0) rectangle +(0.6, 4.1);

%legend
\begin{scope}[shift={(2,8.5)}] 
\draw[mrsp] (0,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\scriptsize MrsP};
\draw[ceiling] (3,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\tiny Simple Ceiling};
\draw[nopreempt] (6,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\tiny Non preemption};
\end{scope}

\end{tikzpicture}}

\newcommand{\confrontoProtocolliLTre}{%
  \begin{tikzpicture}[
  xscale=0.8,
  yscale=0.6,
  mrsp/.style={fill=black!30},
  ceiling/.style={ fill=black!50},
  nopreempt/.style={fill=black!80},
  assi/.style={very thick, <-}
  ]
    % Axis
    \coordinate (y) at (0,8);
    \coordinate (x) at (12,0);
    \draw[assi] (y) node[above=-3cm, right=-0.9cm, rotate=90, font=\tiny] {Response time} -- (0,0) -- (x);

    \coordinate (one) at (1.5,-0.5);
    \coordinate (two) at (4.5,-0.5);
    \coordinate (three) at (7.5,-0.5);
    \coordinate (four) at (10.5,-0.5);
%4 gruppi
%3 barre ognuno

\draw[line width=0.1mm, gray, dashed] (-0.7,1)node[black, above=0.2cm, right=-0.2cm] {\tiny 1 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,2)node[black, above=0.2cm, right=-0.2cm] {\tiny 2 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,3)node[black, above=0.2cm, right=-0.2cm] {\tiny 3 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,4)node[black, above=0.2cm, right=-0.2cm] {\tiny 4 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,5)node[black, above=0.2cm, right=-0.2cm] {\tiny 5 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,6)node[black, above=0.2cm, right=-0.2cm] {\tiny 6 $ ms$} -- +(12.5, 0);
\draw[line width=0.1mm, gray, dashed] (-0.7,7)node[black, above=0.2cm, right=-0.2cm] {\tiny 7 $ ms$} -- +(12.5, 0);

\path(one)node[below=+0.1cm]{\tiny CS = 1ms};
\path(one)node[below=-0.2cm]{\tiny WCET = 1ms};

\path(two)node[below=+0.1cm]{\tiny CS = 3ms};
\path(two)node[below=-0.2cm]{\tiny WCET = 1ms};

\path(three)node[below=+0.1cm]{\tiny CS = 1ms};
\path(three)node[below=-0.2cm]{\tiny WCET = 3ms};

\path(four)node[below=+0.1cm]{\tiny CS = 1ms};
\path(four)node[below=-0.2cm]{\tiny WCET = 3ms};
\path(four)node[below=+0.4cm]{\tiny 2 migrations};

%%%%%%%%%%  H2
%  MRSP - CEILING - NP

% PRIMO (1 - 1)
% $L_3$ & 2.351.562 & 3.168.240 & 1.911.890 \\

% gruppo uno - coord 0 -- 3
\draw[mrsp]  (0.4, 0) rectangle +(0.6, 2.28);
\draw[ceiling]  (1.2, 0) rectangle +(0.6, 3.15);
\draw[nopreempt]  (2, 0) rectangle +(0.6, 1.91);

% SECONDO (SC3 - h1)
%$L_3$ & 6.099.752 & 7.209.873 & 6.024.691 \\

% gruppo uno - coord 3 -- 6
\draw[mrsp]  (3.4, 0) rectangle +(0.6, 6.1);
\draw[ceiling]  (4.2, 0) rectangle +(0.6, 7.2);
\draw[nopreempt]  (5, 0) rectangle +(0.6, 6.02);

%TERZO (SC1 - H3)
%$L_3$ & 2.042.122 & 5.169.139 & 2.068.905 \\

% gruppo uno - coord 6 -- 9
\draw[mrsp]  (6.4, 0) rectangle +(0.6, 2.04);
\draw[ceiling]  (7.2, 0) rectangle +(0.6, 5.1);
\draw[nopreempt]  (8, 0) rectangle +(0.6, 2.06);

%QUARTO (SC1 - H3)^2
% $L_5$ & 3.030.634 & 6.309.370 & 3.184.333 \\

% gruppo uno - coord 9 -- 12
\draw[mrsp]  (9.4, 0) rectangle +(0.6, 3.03);
\draw[ceiling]  (10.2, 0) rectangle +(0.6, 6.3);
\draw[nopreempt]  (11, 0) rectangle +(0.6, 3.1);

%legend
\begin{scope}[shift={(2,8.5)}] 
\draw[mrsp] (0,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\scriptsize MrsP};
\draw[ceiling] (3,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\tiny Simple Ceiling};
\draw[nopreempt] (6,0) rectangle +(1, 0.6) node[right=-0.4cm, below=0.35cm, color=black]{\tiny Non preemption};
\end{scope}

\end{tikzpicture}}